<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img:hover {

            /* rgba   颜色透明 */

            /* 透明度   opacity整个盒子透明  css3新增的 */
            opacity: .5;
        }


        .a {
            width: 300px;
            height: 30px;
            background-color: #f00;
        }

        .a:hover {
            opacity: .5;

            /* IE8下的兼容写法 */
            /* filter滤镜  alpha透明度 */
            filter: alpha(opacity=50);
            /* background-color: rgba(255,0,0,.5); */
        }
    </style>
</head>

<body>


    <img src="https://img13.360buyimg.com/seckillcms/s280x280_jfs/t1/130705/10/28613/28826/636b0f6bE4998ffc2/3b4cd373d837cf77.jpg.avif"
        alt="">

    <div class="a">11111</div>

</body>

</html>